package com.hw.disruptor.workHandler;

import com.hw.disruptor.event.LongEvent;
import com.lmax.disruptor.WorkHandler;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @program: disruptor-quickstart
 * @description:
 * @author: hewei
 * @date: 2023-07-06 17:39
 **/
public class TimeWorkHandler implements WorkHandler<LongEvent> {

    private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
    @Override
    public void onEvent(LongEvent longEvent) throws Exception {
        System.out.println("worker:" + Thread.currentThread().getName() + " 时间："+formatter.format(LocalDateTime.now()));
    }
}
